/*
 * File: P2085.java
 * Date: 3 December 2011 10:35:53 PM
 * Author: Quipoz Limited
 * 
 * Class transformed from P2085.CBL
 * 
 * Copyright (2007) CSC Asia, all rights reserved.
 */
package com.csc.fsu.financials.programs;

import com.quipoz.framework.datatype.*;
import com.quipoz.framework.exception.ServerException;
import com.quipoz.framework.exception.TransferProgramException;
import com.quipoz.framework.screenmodel.ScreenModel;
import com.quipoz.framework.sessionfacade.JTAWrapper;
import com.quipoz.framework.util.*;
import com.quipoz.COBOLFramework.util.*;
import static com.quipoz.COBOLFramework.COBOLFunctions.*;
import static com.quipoz.COBOLFramework.util.CLFunctions.*;
import com.csc.smart400framework.dataaccess.SmartFileCode;
import com.csc.smart400framework.utility.ExitSection;
import com.csc.smart400framework.utility.Validator;
import com.quipoz.COBOLFramework.datatype.ValueRange;
import java.util.ArrayList;
import com.quipoz.framework.util.log.QPLogger;

import com.csc.fsu.general.dataaccess.BbalTableDAM;
import com.csc.fsu.financials.dataaccess.CheqTableDAM;
import com.csc.fsu.financials.dataaccess.CheqchqTableDAM;
import com.csc.smart.dataaccess.DescTableDAM;
import com.csc.smart.dataaccess.ItemTableDAM;
import com.csc.fsu.general.dataaccess.PreqTableDAM;
import com.csc.fsu.general.dataaccess.RdocTableDAM;
import com.csc.fsu.general.dataaccess.WtaxTableDAM;
import com.csc.fsu.clients.recordstructures.Clntkey;
import com.csc.smart.recordstructures.Batckey;
import com.csc.fsu.general.recordstructures.Rdockey;
import com.csc.fsu.general.recordstructures.Reqproccpy;
import com.csc.smart.recordstructures.Sftlockrec;
import com.csc.smart.recordstructures.Atreqrec;
import com.csc.fsu.financials.tablestructures.T3672rec;
import com.csc.fsu.financials.recordstructures.P2085rec;
import com.csc.fsu.financials.recordstructures.Clm2authr;
import com.csc.smart.recordstructures.Datcon1rec;
import com.csc.fsu.clients.recordstructures.Fsupfxcpy;
import com.csc.smart.recordstructures.Smtpfxcpy;
import com.csc.smart.recordstructures.Responscpy;
import com.csc.fsu.general.recordstructures.Rtvprtfrec;
import com.csc.smart.recordstructures.Sanctnrec;
import com.csc.fsu.general.recordstructures.Chkbkcdrec;
import com.csc.fsu.general.recordstructures.Chkauthrec;
import com.csc.fsu.general.recordstructures.Gpayupdrec;
import com.csc.fsu.financials.tablestructures.T3616rec;
import com.csc.fsu.general.tablestructures.Tr386rec;
import com.quipoz.COBOLFramework.datatype.Dbcstrncpy;
import com.csc.fsu.general.recordstructures.Reqntypcpy;
import com.csc.smart.recordstructures.Optswchrec;
import com.csc.fsu.general.recordstructures.Prtclmfrec;
import com.csc.fsu.general.recordstructures.Cclmpayrec;
import com.csc.smart400framework.recordstructures.Msgboxrec;
import com.csc.fsu.general.recordstructures.Clmrssrec;
import com.csc.fsu.general.recordstructures.Wsspdsbs;

import com.csc.smart400framework.parent.ScreenProgram;
import com.csc.fsu.financials.screens.S2085ScreenVars;


import com.csc.smart.procedures.Atreq;
import com.csc.fsu.general.procedures.Chkauth;
import com.csc.fsu.general.procedures.Chkauth2;
import com.csc.fsu.general.procedures.Chkbkcd;
import com.csc.smart400framework.utility.Datcon1;
import com.csc.smart.procedures.Gettim;
import com.csc.smart400framework.programs.Msgbox;
import com.csc.smart400framework.procedures.Optswch;
import com.csc.fsu.financials.procedures.P2085sl;
import com.csc.fsu.general.procedures.Rtvprtf;
import com.csc.smart.procedures.Sanctn;
import com.csc.smart.procedures.Sftlock;
import com.csc.smart400framework.procedures.Syserr;
import com.csc.smart400framework.parent.ScreenProgCS;

import com.quipoz.COBOLFramework.GOTOException;
import com.quipoz.COBOLFramework.GOTOInterface;
import com.vch.ws.TestVCHService;

/**
* <pre>
* Generation Parameters SCRVER(02)               Do Not Delete!    S9503>
*REMARKS.
*              Disbursement Authorisation
*
* This program allows the user to authorise existing
* disbursement requisitions.
*
* The program accepts the document key through the
* WSSP-DOCTKEY and displays a screen with several dissections.
*
* The user may review the dissections by using the scroll up
* and scroll down keys.
*
* An auditing check is applied to ensure the user who created
* the payment request is different to the user who is actually
* performing the authorisation.
*
*****************************************************
* </pre>
*/
public class P2085 extends ScreenProgCS {

	public static final String ROUTINE = QPUtilities.getThisClass();
	public int numberOfParameters = 0;
	private FixedLengthStringData wsaaProg = new FixedLengthStringData(5).init("P2085");
	private final String wsaaClm2auth = "CLM2AUTH";
	private FixedLengthStringData wsaaVersion = new FixedLengthStringData(2).init("01");
	private ZonedDecimalData sub = new ZonedDecimalData(4, 0).init(0).setUnsigned();
	private ZonedDecimalData wsaaTime = new ZonedDecimalData(6, 0).setUnsigned();
	private ZonedDecimalData wsaaToday = new ZonedDecimalData(8, 0).init(0).setUnsigned();
	private final String wsaaClStar = "CL***   ";

	private FixedLengthStringData wsaaPassword = new FixedLengthStringData(6);
	private ZonedDecimalData wsaaSancusr = new ZonedDecimalData(6, 0).isAPartOf(wsaaPassword, 0).setUnsigned();
		/* WSAA-OPTION-INFO */
	private PackedDecimalData wsaaOptSub = new PackedDecimalData(3, 0);

	private FixedLengthStringData wsaaOtherDetail = new FixedLengthStringData(1);
	private Validator otherDetailRequired = new Validator(wsaaOtherDetail, "Y");

	private FixedLengthStringData wsaaFoundCheckBox = new FixedLengthStringData(1).init(SPACES);
	private Validator foundCheckBox = new Validator(wsaaFoundCheckBox, "Y");
	private static final int wsaaSwitchNum = 5;
	private static final String wsaaGchkclm = "GCHKCLM";

	private FixedLengthStringData wsaaRtvprtfItemkey = new FixedLengthStringData(6);
	private FixedLengthStringData wsaaRtvprtfLanguage = new FixedLengthStringData(1).isAPartOf(wsaaRtvprtfItemkey, 0);
	private FixedLengthStringData wsaaRtvprtfIdentifier = new FixedLengthStringData(2).isAPartOf(wsaaRtvprtfItemkey, 1).init(SPACES);
	private FixedLengthStringData wsaaRtvprtfAll = new FixedLengthStringData(3).isAPartOf(wsaaRtvprtfItemkey, 3).init("***");

	private FixedLengthStringData wsaaTransArea = new FixedLengthStringData(200);
	private FixedLengthStringData wsaaTransFsuco = new FixedLengthStringData(1).isAPartOf(wsaaTransArea, 0);
	private FixedLengthStringData filler = new FixedLengthStringData(199).isAPartOf(wsaaTransArea, 1, FILLER);

	private FixedLengthStringData wsaaAtTransRec = new FixedLengthStringData(37);
	private FixedLengthStringData wsaaFsuCoy2 = new FixedLengthStringData(1).isAPartOf(wsaaAtTransRec, 0);
	private ZonedDecimalData wsaaTransactionDate2 = new ZonedDecimalData(6, 0).isAPartOf(wsaaAtTransRec, 1);
	private ZonedDecimalData wsaaTransactionTime2 = new ZonedDecimalData(6, 0).isAPartOf(wsaaAtTransRec, 7);
	private ZonedDecimalData wsaaUser2 = new ZonedDecimalData(6, 0).isAPartOf(wsaaAtTransRec, 13);
	private FixedLengthStringData wsaaTermid2 = new FixedLengthStringData(4).isAPartOf(wsaaAtTransRec, 19);
	private FixedLengthStringData wsaaUserid2 = new FixedLengthStringData(10).isAPartOf(wsaaAtTransRec, 23);
	private FixedLengthStringData wsaaAtBatctrcde2 = new FixedLengthStringData(4).isAPartOf(wsaaAtTransRec, 33);

	private FixedLengthStringData wsaaChqdup = new FixedLengthStringData(10);
	private FixedLengthStringData wsaaCheqno = new FixedLengthStringData(9).isAPartOf(wsaaChqdup, 0);
	private FixedLengthStringData wsaaDupno = new FixedLengthStringData(1).isAPartOf(wsaaChqdup, 9);

	private FixedLengthStringData wsaaTransactionRec = new FixedLengthStringData(23);
	private FixedLengthStringData wsaaFsuCoy = new FixedLengthStringData(1).isAPartOf(wsaaTransactionRec, 0).init(SPACES);
	private ZonedDecimalData wsaaTransactionDate = new ZonedDecimalData(6, 0).isAPartOf(wsaaTransactionRec, 1).setUnsigned();
	private ZonedDecimalData wsaaTransactionTime = new ZonedDecimalData(6, 0).isAPartOf(wsaaTransactionRec, 7).setUnsigned();
	private ZonedDecimalData wsaaUser = new ZonedDecimalData(6, 0).isAPartOf(wsaaTransactionRec, 13).setUnsigned();
	private FixedLengthStringData wsaaTermid = new FixedLengthStringData(4).isAPartOf(wsaaTransactionRec, 19).init(SPACES);

		/*01  WSAA-RESPONSEY.                                              
		01  WSAA-RESPONSEN.                                              
		        ' not authorised'.                                       */
	private FixedLengthStringData wsaaBatcKey = new FixedLengthStringData(22);
	private FixedLengthStringData wsaaBatcBatctrcde = new FixedLengthStringData(5).isAPartOf(wsaaBatcKey, 17);

	private FixedLengthStringData wsaaTr386Key = new FixedLengthStringData(9);
	private FixedLengthStringData wsaaTr386Lang = new FixedLengthStringData(1).isAPartOf(wsaaTr386Key, 0);
	private FixedLengthStringData wsaaTr386Pgm = new FixedLengthStringData(5).isAPartOf(wsaaTr386Key, 1);
	private static final int wsaaLitrLen30 = 30;

	private FixedLengthStringData wsaaTrancde = new FixedLengthStringData(4);
	private Validator authorize = new Validator(wsaaTrancde, "T209");
	private Validator approval = new Validator(wsaaTrancde, "TR2V");
	private static final String wsaaCclmpay = "CCLMPAY";
		/* WSAA-COUNTERS */
	private PackedDecimalData ix = new PackedDecimalData(5, 0);

	private FixedLengthStringData wsaaPaxmsgs = new FixedLengthStringData(7);
	private FixedLengthStringData wsaaPaxmsgLanguage = new FixedLengthStringData(1).isAPartOf(wsaaPaxmsgs, 0);
	private FixedLengthStringData wsaaPaxmsg = new FixedLengthStringData(6).isAPartOf(wsaaPaxmsgs, 1);
		/* TABLES */
	private static final String t3672 = "T3672";
	private static final String t3616 = "T3616";
	private static final String tr386 = "TR386";
	private static final String tr272 = "TR272";
	private static final String e315 = "E315";
	private static final String h146 = "H146";
	private static final String h931 = "H931";
	private static final String rf28 = "RF28";
	private static final String rf31 = "RF31";
	private static final String e267 = "E267";
	private static final String p286 = "P286";
	private static final String cheqrec = "CHEQREC";
	private static final String itemrec = "ITEMREC";
	private static final String preqrec = "PREQREC";
	private static final String bbalrec = "BBALREC";
	private static final String cheqchqrec = "CHEQCHQREC";
	private static final String wtaxrec = "WTAXREC";

	private FixedLengthStringData gchkclmRec = new FixedLengthStringData(19);
	private FixedLengthStringData gchkclmInputParams = new FixedLengthStringData(14).isAPartOf(gchkclmRec, 0);
	private FixedLengthStringData gchkclmModeInd = new FixedLengthStringData(5).isAPartOf(gchkclmInputParams, 0);
	private FixedLengthStringData gchkclmClmcoy = new FixedLengthStringData(1).isAPartOf(gchkclmInputParams, 5);
	private FixedLengthStringData gchkclmClamnum = new FixedLengthStringData(8).isAPartOf(gchkclmInputParams, 6);
	private FixedLengthStringData gchkclmOutputParams = new FixedLengthStringData(5).isAPartOf(gchkclmRec, 14);
	private FixedLengthStringData gchkclmStatuz = new FixedLengthStringData(4).isAPartOf(gchkclmOutputParams, 0);
	private FixedLengthStringData gchkclmOldNewFlag = new FixedLengthStringData(1).isAPartOf(gchkclmOutputParams, 4);
	private BbalTableDAM bbalIO = new BbalTableDAM();
	private CheqTableDAM cheqIO = new CheqTableDAM();
	private CheqchqTableDAM cheqchqIO = new CheqchqTableDAM();
	private DescTableDAM descIO = new DescTableDAM();
	private ItemTableDAM itemIO = new ItemTableDAM();
	private PreqTableDAM preqIO = new PreqTableDAM();
	private RdocTableDAM rdocIO = new RdocTableDAM();
	private WtaxTableDAM wtaxIO = new WtaxTableDAM();
	private Clntkey wsaaClntkey = new Clntkey();
	private Batckey wsaaBatckey = new Batckey();
	private Rdockey wsaaRdockey = new Rdockey();
	private Reqproccpy reqproccpy = new Reqproccpy();
	private Sftlockrec sftlockrec = new Sftlockrec();
	private Atreqrec atreqrec = new Atreqrec();
	private T3672rec t3672rec = new T3672rec();
	private P2085rec p2085rec = new P2085rec();
	private Clm2authr clm2authr = new Clm2authr();
	private Datcon1rec datcon1rec = new Datcon1rec();
	private Fsupfxcpy fsupfxcpy = new Fsupfxcpy();
	private Smtpfxcpy smtpfxcpy = new Smtpfxcpy();
	private Responscpy responscpy = new Responscpy();
	private Rtvprtfrec rtvprtfrec = new Rtvprtfrec();
	private Sanctnrec sanctnrec = new Sanctnrec();
	private Chkbkcdrec chkbkcdrec = new Chkbkcdrec();
	private Chkauthrec chkauthrec = new Chkauthrec();
	private Gpayupdrec gpayupdrec = new Gpayupdrec();
	private T3616rec t3616rec = new T3616rec();
	private Tr386rec tr386rec = new Tr386rec();
	private Dbcstrncpy dbcstrncpy = new Dbcstrncpy();
	private Reqntypcpy reqntypcpy = new Reqntypcpy();
	private Optswchrec optswchrec = new Optswchrec();
	private Prtclmfrec prtclmfrec = new Prtclmfrec();
	private Cclmpayrec cclmpayrec = new Cclmpayrec();
	private Msgboxrec msgboxrec = new Msgboxrec();
	private Clmrssrec crssClmrssRec = new Clmrssrec();
	private Wsspdsbs wsspdsbs = new Wsspdsbs();
	private S2085ScreenVars sv = ScreenProgram.getScreenVars( S2085ScreenVars.class);

/**
 * Contains all possible labels used by goTo action.
 */
	private enum GotoLabel implements GOTOInterface {
		DEFAULT, 
		exit1900, 
		screenEdit22500, 
		exit2090, 
		read2111, 
		nextr2220, 
		exit2220, 
		dberrPara3440, 
		para3600, 
		callLogger3800, 
		exit3900
	}

	public P2085() {
		super();
		screenVars = sv;
		new ScreenModel("S2085", AppVars.getInstance(), sv);
	}


protected FixedLengthStringData getWsaaProg() {
	return wsaaProg;
	}

protected FixedLengthStringData getWsaaVersion() {
	return wsaaVersion;
	}

	/**
	* The mainline method is the default entry point of the program when called by other programs using the
	* Quipoz runtime framework.
	*/
public void mainline(Object... parmArray)
	{
		sv.dataArea = convertAndSetParam(sv.dataArea, parmArray, 3);
		scrnparams.screenParams = convertAndSetParam(scrnparams.screenParams, parmArray, 2);
		wsspdsbs.userArea = convertAndSetParam(wsspdsbs.userArea, parmArray, 1);
		wsspcomn.commonArea = convertAndSetParam(wsspcomn.commonArea, parmArray, 0);
		try {
			super.mainline();
		}
		catch (COBOLExitProgramException e) {
		// Expected exception for control flow purposes
		}
	}
public void processBo(Object... parmArray) {
		sv.dataArea = convertAndSetParam(sv.dataArea, parmArray, 3);
		scrnparams.screenParams = convertAndSetParam(scrnparams.screenParams, parmArray, 2);
		wsspdsbs.userArea = convertAndSetParam(wsspdsbs.userArea, parmArray, 1);
		wsspcomn.commonArea = convertAndSetParam(wsspcomn.commonArea, parmArray, 0);

		try {
			processBoMainline(sv, sv.dataArea, parmArray);
		} catch (COBOLExitProgramException e) {
		// Expected exception for control flow purposes
		}
}


	/**
	* <pre>
	*    COPY NXTPROGCPY.                                             
	*      INITIALISE FIELDS FOR SHOWING ON SCREEN
	* </pre>
	*/
protected void initialise1000()
	{
		try {
			initialise1001();
			retrvCheq1005();
			cont1020();
		}
		catch (GOTOException e){
			/* Expected exception for control flow purposes. */
		}
	}

protected void initialise1001()
	{
		if (isEQ(wsspcomn.secActn[wsspcomn.programPtr.toInt()], "*")) {
			goTo(GotoLabel.exit1900);
		}
		syserrrec.subrname.set(wsaaProg);
		sv.dataArea.set(SPACES);
		p2085rec.p2085Rec.set(SPACES);
		/* Zeroise numeric fields                                          */
		p2085rec.transeq.set(ZERO);
		p2085rec.effdate.set(ZERO);
		p2085rec.docorigamt.set(ZERO);
		p2085rec.docacctamt.set(ZERO);
		p2085rec.currrate.set(ZERO);
		p2085rec.statdate.set(ZERO);
		p2085rec.authdate.set(ZERO);
		p2085rec.presdate.set(ZERO);
		p2085rec.stmtpage.set(ZERO);
		p2085rec.nofLines.set(ZERO);
		/*  Retrieve todays date                                           */
		datcon1rec.function.set(varcom.tday);
		Datcon1.getInstance().mainline(datcon1rec.datcon1Rec);
		wsaaToday.set(datcon1rec.intDate);
		p2085rec.authdate.set(wsaaToday);
		/*--- Read TR386 table to get screen literals                      */
		itemIO.setFormat(itemrec);
		itemIO.setItempfx("IT");
		itemIO.setItemcoy(wsspcomn.fsuco);
		itemIO.setItemtabl(tr386);
		wsaaTr386Lang.set(wsspcomn.language);
		wsaaTr386Pgm.set(wsaaProg);
		/*   MOVE 'N'                    TO WSAA-TR386-ID.                */
		itemIO.setItemitem(wsaaTr386Key);
		itemIO.setFunction(varcom.readr);
		SmartFileCode.execute(appVars, itemIO);
		if (isNE(itemIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(itemIO.getParams());
			fatalError600();
		}
		tr386rec.tr386Rec.set(itemIO.getGenarea());
		wsaaBatckey.batcFileKey.set(wsspcomn.batchkey);
		wsaaTrancde.set(wsaaBatckey.batcBatctrcde);
		if (approval.isTrue()) {
			dbcstrncpy.dbcsInputString.set(tr386rec.progdesc02);
			sv.descrn.set(tr386rec.progdesc04);
		}
		else {
			if (authorize.isTrue()) {
				dbcstrncpy.dbcsInputString.set(tr386rec.progdesc03);
				sv.descrn.set(tr386rec.progdesc05);
			}
			else {
				dbcstrncpy.dbcsInputString.fill("?");
			}
		}
		dbcstrncpy.dbcsOutputLength.set(wsaaLitrLen30);
		a1000Dbcstrnc();
		sv.heading.set(dbcstrncpy.dbcsOutputString);
	}

protected void retrvCheq1005()
	{
		cheqIO.setFunction("RETRV");
		cheqIO.setFormat(cheqrec);
		SmartFileCode.execute(appVars, cheqIO);
		if (isNE(cheqIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(cheqIO.getParams());
			fatalError600();
		}
		sv.reqno.set(cheqIO.getReqnno());
		p2085rec.doctReqno.set(cheqIO.getReqnno());
		p2085rec.reqntype.set(cheqIO.getReqntype());
		cheqIO.setFunction("RLSE");
		cheqIO.setFormat(cheqrec);
		SmartFileCode.execute(appVars, cheqIO);
		if (isNE(cheqIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(cheqIO.getParams());
			fatalError600();
		}
		reqntypcpy.reqntype.set(cheqIO.getReqntype());
		p2085rec.doctCompany.set(cheqIO.getReqncoy());
		p2085rec.doctReqno.set(cheqIO.getReqnno());
		p2085rec.doctPrefix.set("RQ");
		/*--If Authorise/Approve Payment, since payment number is          */
		/*--identify in the previous screen WSSP-RDOCNUM must not          */
		/*--be empty.                                                      */
		if (isEQ(wsspcomn.sbmaction, "C")
		|| isEQ(wsspcomn.sbmaction, "H")
		&& isEQ(wsspdsbs.rdocnum, SPACES)) {
			wsspdsbs.rdocnum.set(cheqIO.getReqnno());
		}
		/*SOF MOVE WSSP-INQKEY            TO R2085-DOCTKEY.                */
		varcom.vrcmTranid.set(wsspcomn.tranid);
		p2085rec.batchkey.set(wsspcomn.batchkey);
		wsaaBatcKey.set(wsspcomn.batchkey);
		p2085rec.progname.set(wsaaProg);
		p2085rec.function.set(varcom.begn);
		callProgram(P2085sl.class, p2085rec.p2085Rec);
		if (isEQ(p2085rec.statuz, varcom.bomb)) {
			syserrrec.statuz.set(p2085rec.statuz);
			fatalError600();
		}
		if (isNE(p2085rec.statuz, varcom.oK)) {
			scrnparams.errorCode.set(p2085rec.statuz);
		}
		sv.inqlines.set(p2085rec.inqlines);
		wsaaClntkey.clntKey.set(p2085rec.clntkey);
		sv.clntfld.set(wsaaClntkey.clntClntnum);
		/*011 MOVE R2085-REQNTYPE         TO RQNT-REQNTYPE.*/
		if (isNE(p2085rec.chqCheqno, p2085rec.doctReqno)) {
			wsaaCheqno.set(p2085rec.chqCheqno);
			wsaaDupno.set(p2085rec.chqDupno);
			sv.chqdup.set(wsaaChqdup);
		}
		sv.bankcode.set(p2085rec.doctBankcode);
		/*MOVE R2085-PTCODE           TO S2085-PTCODE.                 */
		sv.statdetsOut[4].set("Y");
		sv.statdets.set(p2085rec.statdets);
		/******IF R2085-PRESDATE           = 0                              */
		/**********MOVE VRCM-MAX-DATE      TO S2085-STATDATEX               */
		/**********GO TO 1010-CHECK-AUTH.                                   */
		/******MOVE 'Y'                    TO S2085-STATDATEX-OUT (4).      */
		/******MOVE R2085-STATDATE         TO S2085-STATDATEX.              */
		/**1010-CHECK-AUTH.                                                 */
		/******IF R2085-AUTHDATE           = 0                              */
		/**********MOVE VRCM-MAX-DATE      TO S2085-AUTHDATEX               */
		/**********GO TO 1020-CONT.                                         */
		/******MOVE 'Y'                    TO S2085-AUTHDETS-OUT (4).       */
		/******MOVE 'Y'                    TO S2085-AUTHDATEX-OUT (4).      */
		/******MOVE R2085-AUTHDATE         TO S2085-AUTHDATEX.              */
		/******MOVE R2085-AUTHDETS         TO S2085-AUTHDETS.               */
	}

protected void cont1020()
	{
		sv.reqno.set(p2085rec.doctReqno);
		sv.payname.set(p2085rec.payee);
		sv.reqntype.set(p2085rec.reqntype);
		sv.docacctamt.set(p2085rec.docacctamt);
		sv.acctccy.set(p2085rec.acctccy);
		sv.docorigamt.set(p2085rec.docorigamt);
		sv.origccy.set(p2085rec.origccy);
		/*    MOVE R2085-CURRRATE         TO S2085-CURRRATE.               */
		sv.scrate.set(p2085rec.currrate);
		sv.trandatex.set(p2085rec.effdate);
		sv.authnow.set("N");
		/*  Read table T3672 to get payment method parameters.           */
		itemIO.setDataArea(SPACES);
		itemIO.setItempfx("IT");
		itemIO.setItemcoy(wsspcomn.company);
		itemIO.setItemtabl(t3672);
		itemIO.setItemitem(sv.reqntype);
		itemIO.setItemseq(SPACES);
		itemIO.setFormat(itemrec);
		itemIO.setFunction(varcom.readr);
		SmartFileCode.execute(appVars, itemIO);
		if (isNE(itemIO.getStatuz(), varcom.oK)) {
			syserrrec.statuz.set(itemIO.getStatuz());
			syserrrec.params.set(itemIO.getParams());
			fatalError600();
		}
		t3672rec.t3672Rec.set(itemIO.getGenarea());
		wsaaOtherDetail.set(t3672rec.dtlsind);
		screenInitOptswch1910();
		if (!otherDetailRequired.isTrue()
		|| isEQ(sv.xoptind01, SPACES)) {
			sv.zxoptdsc01.set(SPACES);
			sv.xoptind01Out[varcom.nd.toInt()].set("Y");
			sv.xoptind01Out[varcom.pr.toInt()].set("Y");
		}
	}

protected void screenInitOptswch1910()
	{
		screenInit1911();
	}

protected void screenInit1911()
	{
		keepsCheqio5100();
		/*    Retrieve the Switching Options.                              */
		optswchrec.optsFunction.set("INIT");
		optswchrec.optsCallingProg.set(wsaaProg);
		optswchrec.optsDteeff.set(wsaaToday);
		optswchrec.optsCompany.set(wsspcomn.company);
		optswchrec.optsLanguage.set(wsspcomn.language);
		varcom.vrcmTranid.set(wsspcomn.tranid);
		optswchrec.optsUser.set(varcom.vrcmUser);
		callProgram(Optswch.class, optswchrec.rec, wsspcomn.secProgs, wsspcomn.secActns, wsspcomn.programPtr, wsspcomn.flag);
		if (isNE(optswchrec.optsStatuz, varcom.oK)) {
			syserrrec.function.set("INIT");
			syserrrec.dbioStatuz.set(optswchrec.optsStatuz);
			syserrrec.statuz.set(optswchrec.optsStatuz);
			syserrrec.iomod.set("OPTSWCH");
			fatalError600();
		}
		/*    Load the returned options onto the screen.                   */
		for (wsaaOptSub.set(1); !(isGT(wsaaOptSub, 20)
		|| isEQ(optswchrec.optsType[wsaaOptSub.toInt()], SPACES)); wsaaOptSub.add(1)){
			if (isEQ(optswchrec.optsType[wsaaOptSub.toInt()], "X")) {
				sv.zxoptdsc[wsaaOptSub.toInt()].set(optswchrec.optsDsc[wsaaOptSub.toInt()]);
				sv.xoptind[wsaaOptSub.toInt()].set(optswchrec.optsInd[wsaaOptSub.toInt()]);
			}
		}
		/*   Protect and hide unused checkbox screen                       */
		for (wsaaOptSub.set(1); !(isGT(wsaaOptSub, wsaaSwitchNum)); wsaaOptSub.add(1)){
			if (isEQ(sv.zxoptdsc[wsaaOptSub.toInt()], SPACES)) {
				sv.xoptindO[wsaaOptSub.toInt()][varcom.pr.toInt()].set("Y");
				sv.xoptindO[wsaaOptSub.toInt()][varcom.nd.toInt()].set("Y");
			}
		}
		rlseCheqio5110();
	}

protected void preScreenEdit()
	{
		/*PRE-START*/
		if (isEQ(wsspcomn.secActn[wsspcomn.programPtr.toInt()], "*")) {
			wsspcomn.sectionno.set("3000");
			return ;
		}
		sv.chqdupOut[varcom.pr.toInt()].set("N");
		sv.chqdupOut[varcom.nd.toInt()].set("N");
		if (isNE(sv.chqdup, SPACES)
		|| approval.isTrue()) {
			sv.chqdupOut[varcom.pr.toInt()].set("Y");
		}
		if (isNE(t3672rec.chqNumReq, "Y")) {
			sv.chqdupOut[varcom.nd.toInt()].set("Y");
			sv.chqdupOut[varcom.pr.toInt()].set("Y");
		}
		return ;
		/*PRE-EXIT*/
	}

protected void screenEdit2000()
	{
		GotoLabel nextMethod = GotoLabel.DEFAULT;
		while (true) {
			try {
				switch (nextMethod) {
				case DEFAULT: 
					screenEditPara2000();
					scroll2100();
				case screenEdit22500: 
					screenEdit22500();
				case exit2090: 
				}
				break;
			}
			catch (GOTOException e){
				nextMethod = (GotoLabel) e.getNextMethod();
			}
		}
	}

protected void screenEditPara2000()
	{
		/*2001-SCREEN-IO.                                                  */
		if (isEQ(p2085rec.origccy, p2085rec.acctccy)) {
			sv.scrateOut[varcom.nd.toInt()].set("Y");
		}
		else {
			sv.scrateOut[varcom.nd.toInt()].set("N");
		}
		/*SCREEN-IO*/
		/*    CALL 'S2085IO' USING SCRN-SCREEN-PARAMS                      */
		/*                          S2085-DATA-AREA.                       */
		/* Screen errors are now handled in the calling program.           */
		/*    PERFORM 200-SCREEN-ERRORS.                                   */
		wsspcomn.edterror.set(varcom.oK);
	}

protected void scroll2100()
	{
		if (isNE(scrnparams.statuz, varcom.rolu)) {
			if (isNE(scrnparams.statuz, varcom.rold)) {
				goTo(GotoLabel.screenEdit22500);
			}
		}
		p2085rec.function.set(scrnparams.statuz);
		callProgram(P2085sl.class, p2085rec.p2085Rec);
		if (isEQ(p2085rec.statuz, varcom.bomb)) {
			syserrrec.statuz.set(p2085rec.statuz);
			fatalError600();
		}
		sv.inqlines.set(p2085rec.inqlines);
		if (isNE(p2085rec.statuz, varcom.oK)) {
			scrnparams.errorCode.set(p2085rec.statuz);
			/*        MOVE 'Y'                TO WSSP-EDTERROR.                */
			wsspcomn.edterror.set("Y");
			/*  The exit paragraph name will be standardised to 2090 -EXIT.    */
			/*        GO TO 2900-EXIT.                                         */
			goTo(GotoLabel.exit2090);
		}
		/* The following line has been changed to follow standar ds        */
		/* and avoid an internal loop.                                     */
		/*    GO TO 2001-SCREEN-IO.                                        */
		wsspcomn.edterror.set("Y");
		goTo(GotoLabel.exit2090);
	}

protected void screenEdit22500()
	{
		/*  Re-Initialize the option indicators incase screen              */
		/*  errors were detected.                                          */
		for (wsaaOptSub.set(1); !(isGT(wsaaOptSub, 20)); wsaaOptSub.add(1)){
			optswchrec.optsInd[wsaaOptSub.toInt()].set(SPACES);
		}
		checkBoxIndic2300();
		if (isEQ(sv.authnow, "N")) {
			/*  The exit paragraph name will be standardised to 2090 -EXIT.    */
			/*        GO TO 2900-EXIT.                                         */
			return ;
		}
		/*  If the cheque number is required (from table T3672) and        */
		/*  the cheque number field is blank, prompt user.                 */
		if (isEQ(t3672rec.chqNumReq, "Y")
		&& authorize.isTrue()
		&& isEQ(sv.chqdup, SPACES)) {
			sv.chqdupErr.set(h931);
			wsspcomn.edterror.set("Y");
			return ;
		}
		if (isNE(sv.authnow, "Y")) {
			sv.authnowErr.set(e315);
			wsspcomn.edterror.set("Y");
			/*  The exit paragraph name will be standardised to 2090 -EXIT.    */
			/*        GO TO 2900-EXIT.                                         */
			return ;
		}
		if (reqntypcpy.expChq.isTrue()
		&& authorize.isTrue()
		&& isEQ(cheqIO.getZprnno(), ZERO)) {
			sv.authnowErr.set(rf28);
			sv.reqnoErr.set(rf28);
			wsspcomn.edterror.set("Y");
			return ;
		}
		if (isGT(sv.chqdup, SPACES)) {
			checkCheqno2111();
			if (isEQ(wsspcomn.edterror, "Y")) {
				return ;
			}
		}
		auditCheck10000();
		/* IF  AUTHORIZE                                        <V63P25>*/
		/* AND WSSP-EDTERROR           = O-K                    <V63P25>*/
		if (isEQ(wsspcomn.edterror, varcom.oK)) {
			/*    PERFORM 3910-READ-PREQ-RECORD                     <FA2999>*/
			/*    IF  PREQ-SACSCODE        = 'CL' AND               <FA2999>*/
			/*        PREQ-SACSTYP         = 'PY'                   <FA2999>*/
			/*        PERFORM 11000-CHKCLM-OUTS                     <FA2999>*/
			/*    END-IF                                            <FA2999>*/
			/*    PERFORM 11000-CHKCLM-OUTS                         <FA2999>*/
			processPreq2200();
		}
		/***** MOVE WSSP-PASSWORD          TO PASS-PASSPSWD.                */
		/******MOVE SMTP-PASS              TO PASS-PASSPFX.                 */
		/***** MOVE PASSREC                TO PASS-FORMAT.                  */
		/***** MOVE READR                  TO PASS-FUNCTION.                */
		/***** CALL  'PASSIO'  USING PASS-PARAMS.                           */
		/***** IF PASS-STATUZ              NOT = O-K                        */
		/*****     MOVE PASS-PARAMS        TO SYSR-PARAMS                   */
		/*****     PERFORM 600-FATAL-ERROR.                                 */
		/******MOVE PASS-SANCPFX           TO SANC-SANCPFX.                 */
		/***** MOVE PASS-SANCCOY           TO SANC-SANCCOY.                 */
		/***** MOVE PASS-SANCUSR           TO SANC-SANCUSR.                 */
		/***** MOVE SANCREC                TO SANC-FORMAT.                  */
		/***** MOVE READR                  TO SANC-FUNCTION.                */
		/***** CALL  'SANCIO'  USING SANC-PARAMS.                           */
		/***** IF SANC-STATUZ              = MRNF                           */
		/*****     MOVE E020               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** IF SANC-STATUZ              NOT = O-K                        */
		/*****     MOVE SANC-PARAMS        TO SYSR-PARAMS                   */
		/*****     PERFORM 600-FATAL-ERROR.                                 */
		/***** IF SANC-VALIDFLAG           NOT = 1                          */
		/*****     MOVE E021               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** MOVE TDAY                   TO DTC1-FUNCTION.                */
		/***** CALL 'DATCON1' USING DTC1-DATCON1-REC.                       */
		/***** IF DTC1-INT-DATE            < SANC-DATESTART  OR             */
		/*****    DTC1-INT-DATE            > SANC-DATEEND                   */
		/*****     MOVE E021               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** MOVE DTC1-INT-DATE          TO R2085-AUTHDATE.               */
		/***** MOVE 0                      TO SUB.                          */
		/**2700-LOOP.                                                       */
		/***** ADD 1                       TO SUB.                          */
		/***** IF SUB                      > 4                              */
		/*****     MOVE E113               TO S2085-BANKCODE-ERR            */
		/*****     MOVE E113               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** IF SANC-BANKCODE (SUB)      NOT = R2085-DOCT-BANKCODE*/
		/*****         GO TO 2700-LOOP.*/
		/***** IF R2085-DOCORIGAMT           < 0*/
		/*****    IF (R2085-DOCORIGAMT * -1) > SANC-MAXALW (SUB)*/
		/*****         MOVE E172           TO S2085-DOCORIGAMT-ERR*/
		/*****         MOVE 'Y'            TO WSSP-EDTERROR*/
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****         GO TO 2900-EXIT.                                     */
		/*****         GO TO 2090-EXIT.                                     */
		/***** IF R2085-DOCORIGAMT           > 0                            */
		/*****    IF R2085-DOCORIGAMT      > SANC-MAXALW (SUB)              */
		/*****         MOVE E172           TO S2085-DOCORIGAMT-ERR          */
		/*****         MOVE 'Y'            TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****         GO TO 2900-EXIT.                                     */
		/*****         GO TO 2090-EXIT.                                     */
		/**2800-CONT.                                                       */
		/***** MOVE S2085-PASSWORD         TO PASS-PASSPSWD.                */
		/******MOVE SMTP-PASS              TO PASS-PASSPFX.                 */
		/***** MOVE PASSREC                TO PASS-FORMAT.                  */
		/***** MOVE READR                  TO PASS-FUNCTION.                */
		/***** CALL  'PASSIO'  USING PASS-PARAMS.                           */
		/***** IF PASS-STATUZ              = BCTL                           */
		/*****    MOVE E035                TO S2085-PASSWORD-ERR            */
		/*****    MOVE 'Y'                 TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****    GO TO 2900-EXIT.                                          */
		/*****    GO TO 2090-EXIT.                                          */
		/***** IF PASS-STATUZ              = MRNF                           */
		/*****     MOVE E018               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** IF PASS-STATUZ              NOT = O-K                        */
		/*****     MOVE PASS-PARAMS        TO SYSR-PARAMS                   */
		/*****     PERFORM 600-FATAL-ERROR.                                 */
		/***** IF WSSP-PASSWORD            NOT = S2085-PASSWORD             */
		/*****     MOVE F481               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** MOVE PASS-SANCUSR           TO WSAA-SANCUSR.            <004>*/
		/***** IF WSAA-SANCUSR             =  CHEQ-REQUSER             <004>*/
		/*****     MOVE H146               TO S2085-PASSWORD-ERR       <004>*/
		/*****     MOVE 'Y'                TO WSSP-EDTERROR            <004>*/
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                    <004>*/
		/*****     GO TO 2090-EXIT.                                    <004>*/
		/***** IF PASS-VALIDFLAG           NOT = 1                          */
		/*****     MOVE E018               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/***** IF DTC1-INT-DATE            < PASS-DATESTART  OR             */
		/*****    DTC1-INT-DATE            > PASS-DATEEND                   */
		/*****     MOVE E004               TO S2085-PASSWORD-ERR            */
		/*****     MOVE 'Y'                TO WSSP-EDTERROR                 */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/*****     GO TO 2900-EXIT.                                         */
		/*****     GO TO 2090-EXIT.                                         */
		/**  The exit paragraph name will be standardised to 2090 -EXIT.    */
		/**2900-EXIT.                                                       */
	}

protected void checkCheqno2111()
	{
		GotoLabel nextMethod = GotoLabel.DEFAULT;
		while (true) {
			try {
				switch (nextMethod) {
				case DEFAULT: 
					begin2111();
				case read2111: 
					read2111();
				}
				break;
			}
			catch (GOTOException e){
				nextMethod = (GotoLabel) e.getNextMethod();
			}
		}
	}

protected void begin2111()
	{
		cheqchqIO.setReqncoy(cheqIO.getReqncoy());
		cheqchqIO.setCheqno(sv.chqdup);
		cheqchqIO.setFunction(varcom.begn);
	}

protected void read2111()
	{
		cheqchqIO.setFormat(cheqchqrec);
		SmartFileCode.execute(appVars, cheqchqIO);
		if (isEQ(cheqchqIO.getStatuz(), varcom.oK)
		&& isEQ(cheqchqIO.getReqncoy(), cheqIO.getReqncoy())
		&& isEQ(cheqchqIO.getCheqno(), sv.chqdup)
		&& isEQ(cheqchqIO.getReqnbcde(), sv.bankcode)
		&& isNE(cheqchqIO.getReqnno(), sv.reqno)
		&& isNE(cheqchqIO.getProcind(), "RC")) {
			sv.chqdupErr.set(e267);
			wsspcomn.edterror.set("Y");
			return ;
		}
		if (isEQ(cheqchqIO.getStatuz(), varcom.endp)
		|| isNE(cheqchqIO.getReqncoy(), cheqIO.getReqncoy())
		|| isNE(cheqchqIO.getCheqno(), sv.chqdup)) {
			return ;
		}
		if (isNE(cheqchqIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(cheqchqIO.getParams());
			fatalError600();
		}
		cheqchqIO.setFunction(varcom.nextr);
		goTo(GotoLabel.read2111);
	}

protected void processPreq2200()
	{
		/*BEGIN*/
		preqIO.setRdocpfx(fsupfxcpy.reqn);
		preqIO.setRdoccoy(cheqIO.getReqncoy());
		preqIO.setRdocnum(cheqIO.getReqnno());
		preqIO.setJrnseq(0);
		preqIO.setFormat(preqrec);
		preqIO.setFunction(varcom.begn);
		SmartFileCode.execute(appVars, preqIO);
		while ( !(isEQ(preqIO.getStatuz(), varcom.endp))) {
			callCclmpay2220();
		}
		
		/*EXIT*/
	}

protected void callCclmpay2220()
	{
		GotoLabel nextMethod = GotoLabel.DEFAULT;
		while (true) {
			try {
				switch (nextMethod) {
				case DEFAULT: 
					begin2220();
				case nextr2220: 
					nextr2220();
				case exit2220: 
				}
				break;
			}
			catch (GOTOException e){
				nextMethod = (GotoLabel) e.getNextMethod();
			}
		}
	}

protected void begin2220()
	{
		if (isEQ(preqIO.getStatuz(), varcom.oK)
		&& isEQ(preqIO.getRdocpfx(), fsupfxcpy.reqn)
		&& isEQ(preqIO.getRdoccoy(), cheqIO.getReqncoy())
		&& isEQ(preqIO.getRdocnum(), cheqIO.getReqnno())) {
			/*NEXT_SENTENCE*/
		}
		else {
			preqIO.setStatuz(varcom.endp);
			goTo(GotoLabel.exit2220);
		}
		crssClmrssRec.set(preqIO.getExtra());
		if (isEQ(preqIO.getSacscode(), "CL")
		&& isEQ(preqIO.getSacstyp(), "PY")
		&& isEQ(crssClmrssRec.payflg, "F")) {
			/*NEXT_SENTENCE*/
		}
		else {
			goTo(GotoLabel.nextr2220);
		}
		initialize(cclmpayrec.cclmpayRec);
		cclmpayrec.function.set("PCLPY");
		cclmpayrec.reqncoy.set(wsspcomn.company);
		cclmpayrec.reqnno.set(wsspdsbs.rdocnum);
		cclmpayrec.reqnbcde.set(wsspcomn.bankcode);
		cclmpayrec.rldgcoy.set(wsspcomn.company);
		cclmpayrec.rldgacct.set(crssClmrssRec.claim);
		callProgram(wsaaCclmpay, cclmpayrec.cclmpayRec);
		if (isEQ(cclmpayrec.statuz, varcom.bomb)) {
			syserrrec.params.set(cclmpayrec.cclmpayRec);
			syserrrec.statuz.set(cclmpayrec.statuz);
			fatalError600();
		}
		if (isNE(cclmpayrec.statuz, varcom.oK)) {
			sv.passwdErr.set(cclmpayrec.statuz);
			wsspcomn.edterror.set("Y");
			goTo(GotoLabel.exit2220);
		}
		msgboxrec.cpfmsg.set(SPACES);
		msgboxrec.insert.set(SPACES);
		msgboxrec.reply.set(SPACES);
		msgboxrec.result.set(SPACES);
		ix.set(1);
		if (approval.isTrue()) {
			for (sub.set(1); !(isGT(sub, 10)); sub.add(1)){
				if (isEQ(cclmpayrec.osProcind[sub.toInt()], "RQ")
				&& isEQ(cclmpayrec.osPayflg[sub.toInt()], "P")) {
					if (isLT(ix, 100)) {
						msgboxrec.insert.setSub1String(ix, 8, cclmpayrec.osReqnno[sub.toInt()]);
						ix.add(8);
					}
				}
			}
		}
		if (authorize.isTrue()) {
			for (sub.set(1); !(isGT(sub, 10)); sub.add(1)){
				if ((isEQ(cclmpayrec.osProcind[sub.toInt()], "AQ")
				|| isEQ(cclmpayrec.osProcind[sub.toInt()], "RQ"))
				&& isEQ(cclmpayrec.osPayflg[sub.toInt()], "P")) {
					if (isLT(ix, 100)) {
						msgboxrec.insert.setSub1String(ix, 8, cclmpayrec.osReqnno[sub.toInt()]);
						ix.add(8);
					}
				}
			}
		}
		if (isEQ(msgboxrec.insert, SPACES)) {
			goTo(GotoLabel.nextr2220);
		}
		wsaaPaxmsgLanguage.set(wsspcomn.language);
		if (approval.isTrue()) {
			wsaaPaxmsg.set("PS0013");
		}
		else {
			wsaaPaxmsg.set("PS0014");
		}
		msgboxrec.cpfmsg.set(wsaaPaxmsgs);
		callProgram(Msgbox.class, msgboxrec.cpfmsg, msgboxrec.insert, msgboxrec.reply, msgboxrec.result);
		wsspcomn.edterror.set("Y");
	}

protected void nextr2220()
	{
		preqIO.setFunction(varcom.nextr);
		SmartFileCode.execute(appVars, preqIO);
	}

protected void checkBoxIndic2300()
	{
		checkBox2301();
	}

protected void checkBox2301()
	{
		for (wsaaOptSub.set(1); !(isGT(wsaaOptSub, wsaaSwitchNum)); wsaaOptSub.add(1)){
			if (isNE(sv.xoptind[wsaaOptSub.toInt()], SPACES)) {
				optswchrec.optsFunction.set("CHCK");
				optswchrec.optsCallingProg.set(wsaaProg);
				optswchrec.optsDteeff.set(ZERO);
				optswchrec.optsCompany.set(wsspcomn.company);
				optswchrec.optsLanguage.set(wsspcomn.language);
				varcom.vrcmTranid.set(wsspcomn.tranid);
				optswchrec.optsUser.set(varcom.vrcmUser);
				optswchrec.optsSelCode.set("CBOX");
				optswchrec.optsInd[wsaaOptSub.toInt()].set(sv.xoptind[wsaaOptSub.toInt()]);
				callProgram(Optswch.class, optswchrec.rec, wsspcomn.secProgs, wsspcomn.secActns, wsspcomn.programPtr, wsspcomn.flag);
				if (isNE(optswchrec.optsStatuz, varcom.oK)) {
					sv.xoptindErr[wsaaOptSub.toInt()].set(optswchrec.optsStatuz);
					wsspcomn.edterror.set("Y");
				}
				else {
					optswchrec.optsInd[wsaaOptSub.toInt()].set(SPACES);
				}
			}
		}
	}

protected void update3000()
	{
		GotoLabel nextMethod = GotoLabel.DEFAULT;
		while (true) {
			try {
				switch (nextMethod) {
				case DEFAULT: 
					loadWsspFields3025();
					authoriseReqn3100();
				case dberrPara3440: 
					dberrPara3440();
				case para3600: 
					para3600();
					loadGlsign3700();
				case callLogger3800: 
					callLogger3800();
				case exit3900: 
				}
				break;
			}
			catch (GOTOException e){
				nextMethod = (GotoLabel) e.getNextMethod();
			}
		}
	}

protected void loadWsspFields3025()
	{
		if (isEQ(wsspcomn.secActn[wsspcomn.programPtr.toInt()], "*")) {
			goTo(GotoLabel.exit3900);
		}
		p2085rec.tranid.set(wsspcomn.tranid);
		p2085rec.batchkey.set(wsspcomn.batchkey);
		wsaaFoundCheckBox.set("N");
		for (wsaaOptSub.set(1); !(isGT(wsaaOptSub, wsaaSwitchNum)
		|| foundCheckBox.isTrue()); wsaaOptSub.add(1)){
			if (isEQ(sv.xoptind[wsaaOptSub.toInt()], "X")) {
				wsaaFoundCheckBox.set("Y");
			}
		}
		if (foundCheckBox.isTrue()) {
			goTo(GotoLabel.exit3900);
		}
		if (isEQ(sv.authnow, "N")) {
			/*       MOVE 'C'                TO VRCM-MSGTYPE                  */
			/*       MOVE R2085-DOCT-BANKCODE    TO WSAA-BANKCODEN            */
			/*       MOVE R2085-DOCT-REQNO   TO WSAA-REQNON                   */
			/*       MOVE WSAA-RESPONSEN     TO VRCM-MSG                      */
			/*       MOVE VRCM-MSGAREA       TO WSSP-MSGAREA                  */
			wsspcomn.chdrChdrpfx.set("RQ");
			sftlockrec.function.set("UNLK");
			softlock3950();
			/*      MOVE 'Not'                  TO WSSP-CONFIRMATION-KEY<006>*/
			/*      MOVE TR386-PROGDESC-1   TO WSSP-CONFIRMATION-KEY         */
			wsspcomn.confirmationKey.set(tr386rec.progdesc01);
			goTo(GotoLabel.callLogger3800);
		}
		p2085rec.statuz.set(varcom.oK);
		syserrrec.subrname.set(wsaaProg);
	}

protected void authoriseReqn3100()
	{
		cheqIO.setFunction(varcom.readh);
		cheqIO.setReqncoy(p2085rec.doctCompany);
		cheqIO.setReqnno(p2085rec.doctReqno);
		/*    MOVE R2085-DOCTKEY          TO CHEQ-DATA-KEY.                */
		cheqIO.setFormat(cheqrec);
		SmartFileCode.execute(appVars, cheqIO);
		if (isNE(cheqIO.getStatuz(), varcom.oK)) {
			goTo(GotoLabel.dberrPara3440);
		}
		readPreqRecord3910();
		/*  IF  PREQ-SACSTYP           = 'S'                     <V4G013>*/
		/*  AND PREQ-SACSCODE          = 'GC'                    <V4G013>*/
		if (isEQ(preqIO.getSacscode(), "GC")) {
			checkGroupClaim3930();
			if (isEQ(gchkclmOldNewFlag, "O")) {
				updgcpy3920();
			}
			/*****     PERFORM 3920-UPDGCPY                              <GRPHC>*/
		}
		/* MOVE SANC-SANCUSR           TO CHEQ-AUTHUSER.           <003>*/
		/*  MOVE WSAA-SANCUSR           TO CHEQ-AUTHUSER.        <V6F110>*/
		/*  MOVE R2085-AUTHDATE         TO CHEQ-AUTHDATE.        <V6F110>*/
		callProgram(Gettim.class, wsaaTime);
		/*  MOVE WSAA-TIME              TO CHEQ-AUTHTIME.        <V6F110>*/
		/*  MOVE RQFL-AUTH              TO CHEQ-PROCIND.         <V6F110>*/
		if (approval.isTrue()) {
			cheqIO.setAppruser(wsaaSancusr);
			cheqIO.setApprdte(p2085rec.authdate);
			cheqIO.setApprtime(wsaaTime);
			cheqIO.setProcind(reqproccpy.appr);
			wsspcomn.chdrChdrpfx.set(reqproccpy.appr);
		}
		else {
			cheqIO.setAuthuser(wsaaSancusr);
			cheqIO.setAuthdate(p2085rec.authdate);
			cheqIO.setAuthtime(wsaaTime);
			cheqIO.setProcind(reqproccpy.auth);
			
			System.out.println("[DEBUG]Flag on authoriseReqn3100 | cheqIO.getProcind() : " + cheqIO.getProcind());
			String strVCHNo = "";
			System.out.println("[DEBUG]Flag on authoriseReqn3100 | WS Call");
			TestVCHService ws = new TestVCHService();
			strVCHNo = ws.callVCHService("Testdata");
			System.out.println("[DEBUG]Flag on authoriseReqn3100 | Test Update VCHNO " + strVCHNo);
			cheqIO.setVchno(strVCHNo);
			
			wsspcomn.chdrChdrpfx.set(reqproccpy.auth);
		}
		cheqIO.setFunction(varcom.rewrt);
		cheqIO.setReqncoy(p2085rec.doctCompany);
		cheqIO.setReqnno(p2085rec.doctReqno);
		/*    MOVE R2085-DOCTKEY          TO CHEQ-DATA-KEY.                */
		cheqIO.setCheqno(sv.chqdup);
		cheqIO.setFormat(cheqrec);
		SmartFileCode.execute(appVars, cheqIO);
		if (isNE(cheqIO.getStatuz(), varcom.oK)) {
			goTo(GotoLabel.dberrPara3440);
		}
		if (approval.isTrue()) {
			sftlockrec.function.set("UNLK");
			softlock3950();
			goTo(GotoLabel.exit3900);
		}
		/* If this is a POLISY Claims/2 created payment request we have    */
		/* a little extra updating to the claim details to do.             */
		if (isNE(p2085rec.clm2key, SPACES)) {
			/*   MOVE SANC-SANCUSR        TO CL2A-USER                <012>*/
			clm2authr.user.set(wsaaSancusr);
			clm2authr.company.set(p2085rec.doctCompany);
			clm2authr.claim.set(p2085rec.clm2key);
			clm2authr.tranid.set(varcom.vrcmTranid);
			clm2authr.batchkey.set(p2085rec.batchkey);
			clm2authr.tranno.set(ZERO);
			FixedLengthStringData groupTEMP = cheqIO.getParams();
			callProgram(wsaaClm2auth, clm2authr.clm2authrRec, groupTEMP);
			cheqIO.setParams(groupTEMP);
			if (isNE(clm2authr.statuz, varcom.oK)) {
				syserrrec.statuz.set(clm2authr.statuz);
				fatalError600();
			}
		}
		/*    MOVE READH                  TO REQN-FUNCTION.*/
		/*    MOVE R2085-DOCTKEY          TO REQN-DATA-KEY.*/
		/*    MOVE REQNREC                TO REQN-FORMAT.*/
		/*    CALL  'REQNIO'  USING REQN-PARAMS.*/
		/*    IF REQN-STATUZ              NOT = O-K*/
		/*    MOVE SANC-SANCUSR           TO REQN-AUTHUSER.*/
		/*    MOVE R2085-AUTHDATE         TO REQN-AUTHDATE.*/
		/*    CALL 'GETTIM' USING WSAA-TIME.*/
		/*    MOVE WSAA-TIME              TO REQN-AUTHTIME.*/
		/*    MOVE RQFL-AUTH              TO REQN-PROCIND.*/
		/*    MOVE REWRT                  TO REQN-FUNCTION.*/
		/*    MOVE R2085-DOCTKEY          TO REQN-DATA-KEY.*/
		/*    MOVE REQNREC                TO REQN-FORMAT.*/
		/*    CALL  'REQNIO'  USING REQN-PARAMS.*/
		/*    IF REQN-STATUZ              NOT = O-K*/
		/*3200-UPDATE-BBAL.                                                */
		/* MOVE READR                  TO BBAL-FUNCTION.                */
		/* MOVE SMTP-BBAL              TO BBAL-BBALPFX.                 */
		/* MOVE R2085-DOCT-COMPANY     TO BBAL-BBALCOY.                 */
		/* MOVE R2085-DOCT-BANKCODE    TO BBAL-BBALCODE.                */
		/* MOVE BBALREC                TO BBAL-FORMAT.                  */
		/* CALL 'BBALIO' USING BBAL-PARAMS.                             */
		/* IF (BBAL-STATUZ             NOT = O-K) AND                   */
		/*    (BBAL-STATUZ             NOT = MRNF)                      */
		/*     MOVE BBAL-STATUZ        TO WSAA-STATUZ                   */
		/*      GO TO 3460-BBALERR-PARA.                                */
		/* IF BBAL-STATUZ              = MRNF                           */
		/*    MOVE R2085-DOCT-BANKCODE TO BBAL-BBALCODE                 */
		/*    MOVE 0                   TO BBAL-BBALBAL                  */
		/*    MOVE R2085-AUTHDATE      TO BBAL-BBALTDTE                 */
		/*    MOVE WSAA-TIME           TO BBAL-BBALTIME                 */
		/*    MOVE WRITR               TO BBAL-FUNCTION                 */
		/*    CALL 'BBALIO' USING BBAL-PARAMS                           */
		/*    IF BBAL-STATUZ           NOT = O-K                        */
		/*       MOVE BBAL-STATUZ      TO WSAA-STATUZ                   */
		/*        GO TO 3460-BBALERR-PARA.                              */
		/* IF R2085-HDR-SIGN           = '+' OR SPACES                  */
		/*    ADD R2085-DOCORIGAMT     TO BBAL-BBALBAL                  */
		/* ELSE                                                         */
		/*    SUBTRACT R2085-DOCORIGAMT FROM BBAL-BBALBAL.              */
		/* MOVE R2085-AUTHDATE         TO BBAL-BBALTDTE.                */
		/* MOVE WSAA-TIME              TO BBAL-BBALTIME.                */
		/* MOVE REWRT                  TO BBAL-FUNCTION.                */
		/* CALL 'BBALIO' USING BBAL-PARAMS.                             */
		/* IF BBAL-STATUZ              NOT = O-K                        */
		/*    MOVE BBAL-STATUZ         TO WSAA-STATUZ                   */
		/*     GO TO 3460-BBALERR-PARA.                                 */
		/*3300-UPDATE-CONTROL-TOTALS.*/
		/*    MOVE R2085-BATCHKEY         TO BCUP-BATCHKEY.*/
		/*    MOVE 11                     TO BCUP-SUB.*/
		/*    MOVE 0                      TO BCUP-TRANCNT.*/
		/*    MOVE 0                      TO BCUP-ETREQCNT.*/
		/*    MOVE 0                      TO BCUP-ASCNT.*/
		/*    MOVE 1                      TO BCUP-BCNT.*/
		/*    MOVE R2085-DOCORIGAMT       TO BCUP-BVAL.*/
		/*    CALL 'BATCUP' USING BCUP-BATCUP-REC.*/
		/*    IF BCUP-STATUZ              NOT = O-K*/
		/*        MOVE BCUP-STATUZ        TO R2085-STATUZ*/
		/*        GO TO 3600-PARA.*/
		goTo(GotoLabel.para3600);
		/**3400-ERROR.                                                      */
	}

protected void syserrPara3420()
	{
		if (isEQ(cheqIO.getStatuz(), varcom.bomb)) {
			goTo(GotoLabel.para3600);
		}
		syserrrec.syserrStatuz.set(cheqIO.getStatuz());
		syserrrec.syserrType.set("2");
		syserrrec.dbparams.set(cheqIO.getParams());
		callProgram(Syserr.class, syserrrec.syserrRec);
		p2085rec.statuz.set(varcom.bomb);
		goTo(GotoLabel.para3600);
		if (isEQ(cheqIO.getStatuz(), varcom.bomb)) {
			goTo(GotoLabel.para3600);
		}
		/**    MOVE REQN-STATUZ            TO SYSR-SYSERR-STATUZ.           */
		/**    MOVE 2                      TO SYSR-SYSERR-TYPE.             */
		/**    CALL 'SYSERR'  USING  SYSR-SYSERR-REC.                       */
		/**    MOVE BOMB                   TO R2085-STATUZ.                 */
		/**    GO TO 3600-PARA.                                             */
	}

protected void dberrPara3440()
	{
		if (isEQ(cheqIO.getStatuz(), varcom.bomb)) {
			goTo(GotoLabel.para3600);
		}
		syserrrec.syserrStatuz.set(cheqIO.getStatuz());
		syserrrec.syserrType.set("1");
		syserrrec.dbparams.set(cheqIO.getParams());
		callProgram(Syserr.class, syserrrec.syserrRec);
		p2085rec.statuz.set(varcom.bomb);
		goTo(GotoLabel.para3600);
		if (isEQ(cheqIO.getStatuz(), varcom.bomb)) {
			goTo(GotoLabel.para3600);
		}
		/**    MOVE REQN-STATUZ            TO SYSR-SYSERR-STATUZ.           */
		/**    MOVE 1                      TO SYSR-SYSERR-TYPE.             */
		/**    CALL 'SYSERR' USING SYSR-SYSERR-REC.                         */
		/**    MOVE BOMB                   TO R2085-STATUZ.                 */
		/**    GO TO 3600-PARA.                                             */
		/**3460-BBALERR-PARA.                                               */
		/***** IF WSAA-STATUZ              = BOMB                           */
		/*****     GO TO 3600-PARA.                                         */
		/***** MOVE WSAA-STATUZ            TO SYSR-SYSERR-STATUZ.           */
		/***** MOVE 1                      TO SYSR-SYSERR-TYPE.             */
		/***** CALL 'SYSERR' USING SYSR-SYSERR-REC.                         */
		/***** MOVE BOMB                   TO R2085-STATUZ.                 */
		/***** GO TO 3600-PARA.                                             */
	}

protected void para3600()
	{
		if (isNE(p2085rec.statuz, varcom.oK)) {
			syserrrec.statuz.set(p2085rec.statuz);
			fatalError600();
		}
		/*   MOVE 'C'                    TO VRCM-MSGTYPE.            <002>*/
		/*   MOVE R2085-DOCT-BANKCODE    TO WSAA-BANKCODE.           <002>*/
		/*   MOVE R2085-DOCT-REQNO       TO WSAA-REQNO.              <002>*/
		/*   MOVE WSAA-RESPONSEY         TO VRCM-MSG.                <002>*/
		/*   MOVE VRCM-MSGAREA           TO WSSP-MSGAREA.            <002>*/
		wsspcomn.chdrChdrpfx.set("AU");
		/*COMMIT.                                                      */
		/* Read T3672, pay method to find out whether "immeadiate post"    */
		/* is relevant.                                                    */
		itemIO.setItempfx("IT");
		itemIO.setItemcoy(wsspcomn.company);
		itemIO.setItemtabl(t3672);
		/*011  MOVE RQNT-REQNTYPE         TO ITEM-ITEMITEM.                */
		itemIO.setItemitem(cheqIO.getReqntype());
		itemIO.setFormat(itemrec);
		itemIO.setFunction(varcom.readr);
		SmartFileCode.execute(appVars, itemIO);
		if (isNE(itemIO.getStatuz(), varcom.oK)
		&& isNE(itemIO.getStatuz(), varcom.mrnf)) {
			syserrrec.params.set(itemIO.getParams());
			fatalError600();
		}
		t3672rec.t3672Rec.set(itemIO.getGenarea());
		/* If the "immeadiate post" indicator is 'Y' call softlock         */
		/* with a 'TOAT' function and then call AT module, otherwise       */
		/* just unlock the record.                                         */
		if (isEQ(t3672rec.immPostInd, "Y")) {
			sftlockrec.function.set("TOAT");
			softlock3950();
			callAt3960();
			printWhtaxcrtVoucher3965();
			a200UpdateBbal();
			facingSheetAt3970();
		}
		else {
			sftlockrec.function.set("UNLK");
			softlock3950();
		}
		wsspcomn.confirmationKey.set(p2085rec.doctReqno);
	}

protected void loadGlsign3700()
	{
		wsspdsbs.hdrSign.set(p2085rec.hdrSign);
	}

protected void callLogger3800()
	{
		callProgram(Gettim.class, varcom.vrcmTime);
		p2085rec.tranid.set(varcom.vrcmTranid);
		p2085rec.language.set(scrnparams.language);
		p2085rec.scrname.set(scrnparams.scrname);
		p2085rec.primaryKey.set(p2085rec.doctkey);
	}

protected void readPreqRecord3910()
	{
		/*READ-PREQ*/
		preqIO.setDataKey(SPACES);
		preqIO.setRdocpfx(fsupfxcpy.reqn);
		preqIO.setRdoccoy(cheqIO.getReqncoy());
		preqIO.setRdocnum(cheqIO.getReqnno());
		preqIO.setJrnseq("0001");
		preqIO.setFunction(varcom.readr);
		SmartFileCode.execute(appVars, preqIO);
		if (isNE(preqIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(preqIO.getParams());
			fatalError600();
		}
		/*EXIT*/
	}

protected void updgcpy3920()
	{
		callSubroutine3920();
	}

protected void callSubroutine3920()
	{
		/*    MOVE SPACES                 TO DESC-DATA-AREA.       <V2.033>*/
		/*    MOVE TR900                  TO DESC-DESCTABL.        <V2.033>*/
		/*    MOVE 'P2085G'               TO DESC-DESCITEM.        <V2.033>*/
		/*    MOVE 'IT'                   TO DESC-DESCPFX.         <V2.033>*/
		/*     MOVE WSSP-COMPANY          TO DESC-DESCCOY.         <V2.033>*/
		/*     MOVE WSSP-LANGUAGE         TO DESC-LANGUAGE.        <V2.033>*/
		/*     MOVE DESCREC               TO DESC-FORMAT.          <V2.033>*/
		/*     MOVE READR                 TO DESC-FUNCTION.        <V2.033>*/
		/*     CALL  'DESCIO'             USING DESC-PARAMS.       <V2.033>*/
		/*    IF DESC-STATUZ           NOT = O-K AND MRNF          <V2.033>*/
		/*        MOVE DESC-PARAMS        TO SYSR-PARAMS           <V2.033>*/
		/*        MOVE DESC-STATUZ        TO SYSR-STATUZ           <V2.033>*/
		/*        PERFORM 600-FATAL-ERROR.                         <V2.033>*/
		/*    MOVE SPACES                 TO UPDGCPY-REC.          <V2.033>*/
		/*    MOVE PREQ-RLDGACCT          TO UPDGCPY-CLAIM-KEY.    <V2.033>*/
		/*    MOVE CHEQ-REQNCOY           TO UPDGCPY-REQNCOY.      <V2.033>*/
		/*    MOVE CHEQ-REQNNO            TO UPDGCPY-REQNNO.       <V2.033>*/
		/*    MOVE CHEQ-CHEQNO            TO UPDGCPY-CHEQNO.       <V2.033>*/
		/*    MOVE DESC-LONGDESC          TO UPDGCPY-SUBRNAME.     <V2.033>*/
		/*    CALL UPDGCPY-SUBRNAME       USING UPDGCPY-REC        <V2.033>*/
		/*    IF UPDGCPY-STATUZ           NOT = O-K                <V2.033>*/
		/*       MOVE UPDGCPY-PARAMS      TO SYSR-PARAMS           <V2.033>*/
		/*       MOVE UPDGCPY-STATUZ      TO SYSR-STATUZ           <V2.033>*/
		/*       MOVE UPDGCPY-SUBRNAME    TO SYSR-SUBRNAME         <V2.033>*/
		/*       PERFORM 600-FATAL-ERROR                           <V2.033>*/
		/*    END-IF.                                              <V2.033>*/
		itemIO.setItemitem(preqIO.getSacscode());
		itemIO.setItemtabl(t3616);
		itemIO.setItemcoy(wsspcomn.company);
		itemIO.setItempfx("IT");
		itemIO.setFormat(itemrec);
		itemIO.setFunction(varcom.readr);
		SmartFileCode.execute(appVars, itemIO);
		if (isNE(itemIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(itemIO.getParams());
			syserrrec.statuz.set(itemIO.getStatuz());
			fatalError600();
		}
		t3616rec.t3616Rec.set(itemIO.getGenarea());
		if (isEQ(t3616rec.subrname, SPACES)) {
			syserrrec.params.set(itemIO.getParams());
			syserrrec.statuz.set(itemIO.getStatuz());
			fatalError600();
		}
		initialize(gpayupdrec.rec);
		gpayupdrec.gpayupdItemcd.set("P2085G");
		gpayupdrec.gpayupdClaimKey.set(preqIO.getRldgacct());
		gpayupdrec.gpayupdCompany.set(cheqIO.getReqncoy());
		gpayupdrec.gpayupdLanguage.set(wsspcomn.language);
		gpayupdrec.gpayupdRdocnum.set(cheqIO.getReqnno());
		gpayupdrec.gpayupdCheqno.set(cheqIO.getCheqno());
		callProgram(t3616rec.subrname, gpayupdrec.rec);
		if (isNE(gpayupdrec.gpayupdStatuz, varcom.oK)) {
			syserrrec.params.set(gpayupdrec.gpayupdInputParm);
			syserrrec.statuz.set(gpayupdrec.gpayupdStatuz);
			fatalError600();
		}
	}

protected void checkGroupClaim3930()
	{
		/*PARA*/
		gchkclmModeInd.set("BATCH");
		gchkclmClmcoy.set(preqIO.getRdoccoy());
		gchkclmClamnum.set(subString(preqIO.getRldgacct(), 1, 8));
		callProgram(wsaaGchkclm, gchkclmRec);
		if (isNE(gchkclmStatuz, varcom.oK)) {
			syserrrec.statuz.set(gchkclmStatuz);
			syserrrec.params.set(gchkclmInputParams);
			fatalError600();
		}
		/*EXIT*/
	}

protected void softlock3950()
	{
		/*CALL-SOFTLOCK*/
		sftlockrec.company.set(wsspcomn.company);
		sftlockrec.enttyp.set("PY");
		sftlockrec.entity.set(sv.reqno);
		sftlockrec.transaction.set(wsaaBatcBatctrcde);
		sftlockrec.user.set(varcom.vrcmUser);
		callProgram(Sftlock.class, sftlockrec.sftlockRec);
		if (isNE(sftlockrec.statuz, varcom.oK)
		&& isNE(sftlockrec.statuz, "LOCK")) {
			syserrrec.statuz.set(sftlockrec.statuz);
			fatalError600();
		}
		/*EXIT*/
	}

protected void callAt3960()
	{
		para3961();
	}

protected void para3961()
	{
		atreqrec.atreqRec.set(SPACES);
		atreqrec.acctYear.set(ZERO);
		atreqrec.acctMonth.set(ZERO);
		atreqrec.module.set("P2085AT");
		atreqrec.batchKey.set(wsspcomn.batchkey);
		atreqrec.reqProg.set(wsaaProg);
		atreqrec.reqUser.set(varcom.vrcmUser);
		/*  MOVE VRCM-TERM            TO  ATRT-REQ-TERM.                 */
		atreqrec.reqTerm.set(varcom.vrcmTermid);
		atreqrec.reqDate.set(wsaaToday);
		atreqrec.reqTime.set(varcom.vrcmTime);
		atreqrec.language.set(wsspcomn.language);
		atreqrec.primaryKey.set(cheqIO.getDataKey());
		wsaaFsuCoy.set(wsspcomn.fsuco);
		wsaaTransactionDate.set(varcom.vrcmDate);
		wsaaTransactionTime.set(varcom.vrcmTime);
		wsaaUser.set(varcom.vrcmUser);
		/*  MOVE VRCM-TERM            TO WSAA-TERMID.                    */
		wsaaTermid.set(varcom.vrcmTermid);
		atreqrec.transArea.set(wsaaTransactionRec);
		callProgram(Atreq.class, atreqrec.atreqRec);
		if (isNE(atreqrec.statuz, varcom.oK)) {
			syserrrec.params.set(atreqrec.atreqRec);
			fatalError600();
		}
	}

protected void printWhtaxcrtVoucher3965()
	{
		start3965();
	}

protected void start3965()
	{
		wtaxIO.setDataArea(SPACES);
		wtaxIO.setStatuz(varcom.oK);
		wtaxIO.setRdocpfx(fsupfxcpy.reqn);
		wtaxIO.setRdoccoy(cheqIO.getReqncoy());
		wtaxIO.setRdocnum(cheqIO.getReqnno());
		wtaxIO.setFunction(varcom.readr);
		wtaxIO.setFormat(wtaxrec);
		SmartFileCode.execute(appVars, wtaxIO);
		if (isNE(wtaxIO.getStatuz(), varcom.oK)
		&& isNE(wtaxIO.getStatuz(), varcom.mrnf)) {
			syserrrec.statuz.set(wtaxIO.getStatuz());
			syserrrec.params.set(wtaxIO.getParams());
			fatalError600();
		}
		if (isEQ(wtaxIO.getStatuz(), varcom.mrnf)) {
			return ;
		}
		printWhtaxcrt3967();
		printVoucher3969();
	}

protected void printWhtaxcrt3967()
	{
		start3967();
	}

protected void start3967()
	{
		/* Get the printing subroutine from TR272 by calling RTVPRTF       */
		initialize(rtvprtfrec.rtvprtfRec);
		rtvprtfrec.company.set(wsspcomn.company);
		/* MOVE WSAA-WHTAXCRT          TO RTVP-BATC-IDENTIFIER. <FA3472>*/
		wsaaRtvprtfLanguage.set(wsspcomn.language);
		wsaaRtvprtfIdentifier.set("WH");
		rtvprtfrec.batcIdentifier.set(wsaaRtvprtfItemkey);
		callProgram(Rtvprtf.class, rtvprtfrec.rtvprtfRec);
		if (isNE(rtvprtfrec.statuz, varcom.oK)) {
			return ;
		}
		initialize(atreqrec.atreqRec);
		atreqrec.acctYear.set(ZERO);
		atreqrec.acctMonth.set(ZERO);
		atreqrec.module.set(rtvprtfrec.printSubr);
		wsaaRdockey.rdocRdocpfx.set(fsupfxcpy.reqn);
		wsaaRdockey.rdocRdoccoy.set(cheqIO.getReqncoy());
		wsaaRdockey.rdocRdocnum.set(cheqIO.getReqnno());
		atreqrec.primaryKey.set(wsaaRdockey);
		atreqrec.batchKey.set(wsspcomn.batchkey);
		atreqrec.reqProg.set(wsaaProg);
		varcom.vrcmTranid.set(wsspcomn.tranid);
		atreqrec.reqUser.set(varcom.vrcmUser);
		atreqrec.reqTerm.set(varcom.vrcmTermid);
		atreqrec.reqDate.set(wsaaToday);
		atreqrec.reqTime.set(varcom.vrcmTime);
		atreqrec.language.set(wsspcomn.language);
		initialize(wsaaTransArea);
		wsaaTransFsuco.set(wsspcomn.fsuco);
		atreqrec.transArea.set(wsaaTransArea);
		callProgram(Atreq.class, atreqrec.atreqRec);
		if (isNE(atreqrec.statuz, varcom.oK)) {
			syserrrec.statuz.set(atreqrec.statuz);
			syserrrec.params.set(atreqrec.atreqRec);
			fatalError600();
		}
	}

protected void printVoucher3969()
	{
		start3969();
	}

protected void start3969()
	{
		/* Get the printing subroutine from TR272 by calling RTVPRTF       */
		initialize(rtvprtfrec.rtvprtfRec);
		rtvprtfrec.company.set(wsspcomn.company);
		/* MOVE WSAA-PAYMENT           TO RTVP-BATC-IDENTIFIER. <FA3472>*/
		wsaaRtvprtfLanguage.set(wsspcomn.language);
		wsaaRtvprtfIdentifier.set("PY");
		rtvprtfrec.batcIdentifier.set(wsaaRtvprtfItemkey);
		callProgram(Rtvprtf.class, rtvprtfrec.rtvprtfRec);
		if (isNE(rtvprtfrec.statuz, varcom.oK)) {
			return ;
		}
		initialize(atreqrec.atreqRec);
		atreqrec.acctYear.set(ZERO);
		atreqrec.acctMonth.set(ZERO);
		atreqrec.module.set(rtvprtfrec.printSubr);
		wsaaRdockey.rdocRdocpfx.set(fsupfxcpy.reqn);
		wsaaRdockey.rdocRdoccoy.set(cheqIO.getReqncoy());
		wsaaRdockey.rdocRdocnum.set(cheqIO.getReqnno());
		atreqrec.primaryKey.set(wsaaRdockey);
		atreqrec.batchKey.set(wsspcomn.batchkey);
		atreqrec.reqProg.set(wsaaProg);
		varcom.vrcmTranid.set(wsspcomn.tranid);
		atreqrec.reqUser.set(varcom.vrcmUser);
		atreqrec.reqTerm.set(varcom.vrcmTermid);
		atreqrec.reqDate.set(wsaaToday);
		atreqrec.reqTime.set(varcom.vrcmTime);
		atreqrec.language.set(wsspcomn.language);
		initialize(wsaaAtTransRec);
		wsaaFsuCoy2.set(wsspcomn.fsuco);
		wsaaTransactionDate2.set(varcom.vrcmDate);
		wsaaTransactionTime2.set(varcom.vrcmTime);
		wsaaUser2.set(varcom.vrcmUser);
		wsaaTermid2.set(varcom.vrcmTermid);
		wsaaUserid2.set(wsspcomn.userid);
		wsaaAtBatctrcde2.set(wsaaBatckey.batcBatctrcde);
		atreqrec.transArea.set(wsaaAtTransRec);
		callProgram(Atreq.class, atreqrec.atreqRec);
		if (isNE(atreqrec.statuz, varcom.oK)) {
			syserrrec.statuz.set(atreqrec.statuz);
			syserrrec.params.set(atreqrec.atreqRec);
			fatalError600();
		}
	}

protected void facingSheetAt3970()
	{
		start3910();
	}

protected void start3910()
	{
		/*--- READ TR272 TO DECIDE WHETHER TO CALL OR NOT                  */
		itemIO.setItempfx(smtpfxcpy.item);
		itemIO.setItemcoy(wsspcomn.company);
		itemIO.setItemtabl(tr272);
		itemIO.setItemitem(wsaaClStar);
		itemIO.setFormat(itemrec);
		itemIO.setFunction(varcom.readr);
		SmartFileCode.execute(appVars, itemIO);
		if (isNE(itemIO.getStatuz(), varcom.oK)) {
			return ;
		}
		initialize(atreqrec.atreqRec);
		atreqrec.module.set("PRTCLMF");
		atreqrec.batchKey.set(wsspcomn.batchkey);
		atreqrec.reqProg.set(wsaaProg);
		varcom.vrcmTranid.set(wsspcomn.tranid);
		atreqrec.reqUser.set(varcom.vrcmUser);
		atreqrec.reqTerm.set(varcom.vrcmTermid);
		atreqrec.reqDate.set(wsaaToday);
		atreqrec.reqTime.set(varcom.vrcmTime);
		atreqrec.language.set(wsspcomn.language);
		wsaaRdockey.set(SPACES);
		wsaaRdockey.rdocRdocpfx.set(fsupfxcpy.reqn);
		wsaaRdockey.rdocRdoccoy.set(cheqIO.getReqncoy());
		wsaaRdockey.rdocRdocnum.set(cheqIO.getReqnno());
		atreqrec.primaryKey.set(wsaaRdockey);
		initialize(prtclmfrec.prtclmfRec);
		prtclmfrec.rdocpfx.set(fsupfxcpy.reqn);
		prtclmfrec.rdoccoy.set(cheqIO.getReqncoy());
		prtclmfrec.rdocnum.set(cheqIO.getReqnno());
		prtclmfrec.language.set(wsspcomn.language);
		prtclmfrec.company.set(wsspcomn.company);
		prtclmfrec.fsuCompany.set(wsspcomn.fsuco);
		atreqrec.transArea.set(prtclmfrec.prtclmfRec);
		callProgram(Atreq.class, atreqrec.atreqRec);
		if (isNE(atreqrec.statuz, varcom.oK)) {
			syserrrec.params.set(atreqrec.atreqRec);
			syserrrec.statuz.set(atreqrec.statuz);
			fatalError600();
		}
	}

protected void whereNext4000()
	{
		nextProgram4010();
		optswch4080();
	}

	/**
	* <pre>
	*4100-NEXT-PROGRAM.                                               
	* </pre>
	*/
protected void nextProgram4010()
	{
		/*    IF SCRN-STATUZ              = ROLU OR                        */
		/*       SCRN-STATUZ              = ROLD                           */
		/*       MOVE SCRN-SCRNAME        TO WSSP-NEXTPROG                 */
		/*       GO TO 4900-EXIT.                                          */
		/*    MOVE WSAA-PROG              TO WSSP-NEXTPROG.                */
		/*    MOVE 'D'                    TO NEXP-FUNCTION.                */
		/*    PERFORM NXTPROG.                                             */
		/*    MOVE WSSP-SUBMENU           TO WSSP-NEXTPROG.                */
		wsaaFoundCheckBox.set("N");
		for (wsaaOptSub.set(1); !(isGT(wsaaOptSub, wsaaSwitchNum)
		|| foundCheckBox.isTrue()); wsaaOptSub.add(1)){
			if (isEQ(sv.xoptind[wsaaOptSub.toInt()], "X")) {
				wsaaFoundCheckBox.set("Y");
				optswchrec.optsInd[wsaaOptSub.toInt()].set(sv.xoptind[wsaaOptSub.toInt()]);
			}
			optswchrec.optsSelType.set(SPACES);
			optswchrec.optsSelCode.set("CBOX");
			optswchrec.optsSelOptno.set(ZERO);
			sv.xoptind[wsaaOptSub.toInt()].set(SPACES);
			keepsCheqio5100();
		}
	}

protected void optswch4080()
	{
		optswchrec.optsFunction.set("STCK");
		callProgram(Optswch.class, optswchrec.rec, wsspcomn.secProgs, wsspcomn.secActns, wsspcomn.programPtr, wsspcomn.flag);
		if (isNE(optswchrec.optsStatuz, varcom.oK)
		&& isNE(optswchrec.optsStatuz, varcom.endp)) {
			syserrrec.function.set("STCK");
			syserrrec.dbioStatuz.set(optswchrec.optsStatuz);
			syserrrec.statuz.set(optswchrec.optsStatuz);
			syserrrec.iomod.set("OPTSWCH");
			fatalError600();
		}
		if (isEQ(wsspcomn.secActn[wsspcomn.programPtr.toInt()], " ")
		&& isEQ(optswchrec.optsStatuz, varcom.endp)) {
			wsspcomn.nextprog.set(scrnparams.scrname);
			rlseCheqio5110();
			screenInitOptswch1910();
		}
		else {
			wsspcomn.programPtr.add(1);
		}
		/***** ADD 1                       TO WSSP-PROGRAM-PTR.     <AXA903>*/
		/**    MOVE SPACES          TO WSSP-SEC-PROG(WSSP-PROGRAM-PTR).<002>*/
		/***** GO TO 4900-EXIT.                                     <AXA903>*/
		/**4900-EXIT.                                                       */
	}

protected void keepsCheqio5100()
	{
		/*KEEPS-CHEQ*/
		cheqIO.setFunction("KEEPS");
		cheqIO.setFormat(cheqrec);
		SmartFileCode.execute(appVars, cheqIO);
		if (isNE(cheqIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(cheqIO.getParams());
			fatalError600();
		}
		/*EXIT*/
	}

protected void rlseCheqio5110()
	{
		/*RLSE-CHEQ*/
		cheqIO.setFunction("RLSE");
		cheqIO.setFormat(cheqrec);
		SmartFileCode.execute(appVars, cheqIO);
		if (isNE(cheqIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(cheqIO.getParams());
			fatalError600();
		}
		/*EXIT*/
	}

protected void auditCheck10000()
	{
		auditCheck10010();
	}

	/**
	* <pre>
	* This entire section has been added under AQR 5132 tag 015.      
	* </pre>
	*/
protected void auditCheck10010()
	{
		/*    Check the user is authorised to the bankcode.                */
		/* MOVE WSSP-USERID            TO UFAB-USERID.          <A06292>*/
		/* MOVE WSSP-COMPANY           TO UFAB-COMPANY.         <A06292>*/
		/* MOVE R2085-DOCT-BANKCODE    TO UFAB-BANKCODE.        <A06292>*/
		/* MOVE READR                  TO UFAB-FUNCTION.        <A06292>*/
		/*                                                      <A06292>*/
		/* CALL  'UFABIO'  USING UFAB-PARAMS.                   <A06292>*/
		/*                                                      <A06292>*/
		/* IF UFAB-STATUZ = MRNF                                <A06292>*/
		/*     MOVE E113               TO S2085-AUTHNOW-ERR     <A06292>*/
		/*     MOVE 'Y'                TO WSSP-EDTERROR         <A06292>*/
		/*     MOVE 'N'                TO S2085-AUTHNOW         <A06292>*/
		/*     GO TO 10090-EXIT                                 <A06292>*/
		/* ELSE                                                 <A06292>*/
		/* IF UFAB-STATUZ              NOT = O-K                <A06292>*/
		/*     MOVE UFAB-PARAMS        TO SYSR-PARAMS           <A06292>*/
		/*     PERFORM 600-FATAL-ERROR.                         <A06292>*/
		/*                                                      <A06292>*/
		/*    Now check to see that the user is not attempting to          */
		/*    authorise a payment which is greater than their authorisation*/
		/*    limit.                                                       */
		/*                                                      <A06292>*/
		/* IF R2085-DOCORIGAMT           < 0                    <A06292>*/
		/*    IF (0 - R2085-DOCORIGAMT) > UFAB-MAXALW01         <A06292>*/
		/*         MOVE E172           TO S2085-DOCORIGAMT-ERR  <A06292>*/
		/*         MOVE 'Y'            TO WSSP-EDTERROR         <A06292>*/
		/*         GO TO 10090-EXIT.                            <A06292>*/
		/*                                                      <A06292>*/
		/* IF R2085-DOCORIGAMT           > 0                    <A06292>*/
		/*    IF R2085-DOCORIGAMT      > UFAB-MAXALW01          <A06292>*/
		/*         MOVE E172           TO S2085-DOCORIGAMT-ERR  <A06292>*/
		/*         MOVE 'Y'            TO WSSP-EDTERROR         <A06292>*/
		/*         GO TO 10090-EXIT.                            <A06292>*/
		/*                                                      <A06292>*/
		/* Call the bankcode authorisation subroutine to check that the */
		/* user is authorised to the bankcode.                          */
		chkbkcdrec.function.set("REQNBANK");
		chkbkcdrec.bankcode.set(sv.bankcode);
		chkbkcdrec.user.set(varcom.vrcmUser);
		chkbkcdrec.company.set(wsspcomn.company);
		callProgram(Chkbkcd.class, chkbkcdrec.chkbkcdRec);
		if (isEQ(chkbkcdrec.statuz, varcom.bomb)) {
			syserrrec.statuz.set(chkbkcdrec.statuz);
			syserrrec.statuz.set(chkbkcdrec.chkbkcdRec);
			fatalError600();
		}
		if (isNE(chkbkcdrec.statuz, varcom.oK)) {
			wsspcomn.edterror.set("Y");
			sv.authnow.set("N");
			sv.bankcodeErr.set(chkbkcdrec.statuz);
			return ;
		}
		/* Call the requisition authorisation subroutine to validate    */
		/* the requisition amount against authorisation limits.         */
		chkauthrec.chkauthRec.set(SPACES);
		chkauthrec.company.set(wsspcomn.company);
		chkauthrec.userid.set(wsspcomn.userid);
		chkauthrec.bankcode.set(sv.bankcode);
		chkauthrec.docorigamt.set(sv.docorigamt);
		/*  CALL 'CHKAUTH'              USING AUTH-CHKAUTH-REC.  <V6F110>*/
		if (approval.isTrue()) {
			callProgram(Chkauth2.class, chkauthrec.chkauthRec);
		}
		else {
			callProgram(Chkauth.class, chkauthrec.chkauthRec);
		}
		if (isEQ(chkauthrec.statuz, varcom.bomb)) {
			syserrrec.statuz.set(chkauthrec.statuz);
			syserrrec.params.set(chkauthrec.chkauthRec);
			fatalError600();
		}
		/* If the authorisation has failed, display an error indicating */
		/* that the user cannot authorise this amount.                  */
		if (isNE(chkauthrec.statuz, varcom.oK)) {
			sv.docorigamtErr.set(chkauthrec.statuz);
			wsspcomn.edterror.set("Y");
			return ;
		}
		/*    Next, check that the user who is authorising the payment     */
		/*    request is different to the person who created the payment   */
		/*    request.                                                     */
		sanctnrec.function.set("USRNO");
		sanctnrec.userid.set(wsspcomn.userid);
		callProgram(Sanctn.class, wsspcomn.commonArea, sanctnrec.sanctnRec);
		if (isNE(sanctnrec.statuz, varcom.oK)) {
			syserrrec.params.set(sanctnrec.sanctnRec);
			syserrrec.subrname.set("SANCTN");
			syserrrec.statuz.set(varcom.bomb);
			fatalError600();
		}
		wsaaPassword.set(sanctnrec.password);
		if (authorize.isTrue()) {
			if (isEQ(wsaaSancusr, cheqIO.getRequser())) {
				sv.authnowErr.set(h146);
				sv.authnow.set("N");
				wsspcomn.edterror.set("Y");
				/*      GO TO 10090-EXIT.                                <V6F110>*/
				return ;
			}
			if (isEQ(wsaaSancusr, cheqIO.getAppruser())) {
				sv.authnowErr.set(rf31);
				sv.authnow.set("N");
				wsspcomn.edterror.set("Y");
				return ;
			}
		}
		/*    Finally check the password entered is for the user for whom  */
		/*    we have been doing all the checking.                         */
		sanctnrec.function.set("PASS");
		sanctnrec.password.set(sv.passwd);
		callProgram(Sanctn.class, wsspcomn.commonArea, sanctnrec.sanctnRec);
		if (isNE(sanctnrec.statuz, varcom.oK)) {
			sv.passwdErr.set(sanctnrec.statuz);
			sv.authnow.set("N");
			wsspcomn.edterror.set("Y");
			return ;
		}
	}

protected void chkclmOuts11000()
	{
		begin11010();
	}

protected void begin11010()
	{
		initialize(cclmpayrec.cclmpayRec);
		cclmpayrec.function.set("REQNN");
		cclmpayrec.reqncoy.set(cheqIO.getReqncoy());
		cclmpayrec.reqnbcde.set(cheqIO.getReqnbcde());
		cclmpayrec.reqnno.set(sv.reqno);
		callProgram(wsaaCclmpay, cclmpayrec.cclmpayRec);
		if (isEQ(cclmpayrec.statuz, varcom.bomb)) {
			syserrrec.params.set(cclmpayrec.cclmpayRec);
			syserrrec.statuz.set(cclmpayrec.statuz);
			fatalError600();
		}
		if (isNE(cclmpayrec.statuz, varcom.oK)) {
			sv.authnowErr.set(cclmpayrec.statuz);
			sv.authnow.set("N");
			wsspcomn.edterror.set("Y");
			return ;
		}
		if (isEQ(cclmpayrec.chkflg, "Y")) {
			sv.authnowErr.set(p286);
			sv.authnow.set("N");
			wsspcomn.edterror.set("Y");
			return ;
		}
	}

protected void a200UpdateBbal()
	{
		a201Begin();
	}

protected void a201Begin()
	{
		bbalIO.setBbalpfx(smtpfxcpy.bbal);
		bbalIO.setBbalcoy(wsspcomn.company);
		bbalIO.setBbalcode(sv.bankcode);
		bbalIO.setFormat(bbalrec);
		bbalIO.setFunction(varcom.readh);
		SmartFileCode.execute(appVars, bbalIO);
		if (isNE(bbalIO.getStatuz(), varcom.oK)
		&& isNE(bbalIO.getStatuz(), varcom.mrnf)) {
			syserrrec.params.set(bbalIO.getParams());
			fatalError600();
		}
		if (isEQ(bbalIO.getStatuz(), varcom.mrnf)) {
			bbalIO.setBbalbal(ZERO);
			bbalIO.setFunction(varcom.writr);
		}
		else {
			bbalIO.setFunction(varcom.rewrt);
		}
		bbalIO.setBbaltdte(wsaaToday);
		callProgram(Gettim.class, wsaaTime);
		bbalIO.setBbaltime(wsaaTime);
		/* If Remove Requisition or Reversal - Add to Bank Bal             */
		/*  Assumed reversal is -ve amt, subtract -ve will have ptve       */
		setPrecision(bbalIO.getBbalbal(), 2);
		bbalIO.setBbalbal(sub(bbalIO.getBbalbal(), sv.docorigamt));
		SmartFileCode.execute(appVars, bbalIO);
		if (isNE(bbalIO.getStatuz(), varcom.oK)) {
			syserrrec.params.set(bbalIO.getParams());
			fatalError600();
		}
	}

protected void a1000Dbcstrnc()
	{
		/*A1010-BEGIN*/
		dbcstrncpy.dbcsStatuz.set(SPACES);
		dbcsTrnc(dbcstrncpy.rec);
		if (isNE(dbcstrncpy.dbcsStatuz, varcom.oK)) {
			dbcstrncpy.dbcsOutputString.fill("?");
		}
		/*A1090-EXIT*/
	}
}
